<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.3.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"example.com","root":"/","scheme":"Muse","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.json"};
  </script>

  <meta name="description" content="一、准备需要的软件1.1 cmakehttps:&#x2F;&#x2F;cmake.org&#x2F;download&#x2F;   1.2 ninjahttps:&#x2F;&#x2F;github.com&#x2F;ninja-build&#x2F;ninja&#x2F;releases&#x2F;tag&#x2F;v1.10.2   ​    Ninja 是Google的一名程序员推出的注重速度的构建工具，一般在Unix&#x2F;Linux上的程序通过make&#x2F;makefile来构建编译，而Ninja通过">
<meta property="og:type" content="article">
<meta property="og:title" content="windows上使用VSCode CMake构建C C++ IDE">
<meta property="og:url" content="http://example.com/2021/08/25/windows%E4%B8%8A%E4%BD%BF%E7%94%A8VSCode%20CMake%E6%9E%84%E5%BB%BAC%20C++%20IDE/index.html">
<meta property="og:site_name" content="学无止境">
<meta property="og:description" content="一、准备需要的软件1.1 cmakehttps:&#x2F;&#x2F;cmake.org&#x2F;download&#x2F;   1.2 ninjahttps:&#x2F;&#x2F;github.com&#x2F;ninja-build&#x2F;ninja&#x2F;releases&#x2F;tag&#x2F;v1.10.2   ​    Ninja 是Google的一名程序员推出的注重速度的构建工具，一般在Unix&#x2F;Linux上的程序通过make&#x2F;makefile来构建编译，而Ninja通过">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210823210956.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210823211526.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210823211635.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210823212036.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210823215506.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210823221753.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824094955.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824095404.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824095527.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824100655.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824101047.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20210824102813.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20210824103927.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824104500.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824192713.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824193001.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/2微信截图_20210824193104.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824200537.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824200746.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824201916.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824202516.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824202759.png">
<meta property="article:published_time" content="2021-08-25T01:12:41.000Z">
<meta property="article:modified_time" content="2021-08-25T01:12:41.000Z">
<meta property="article:author" content="xudonglei">
<meta property="article:tag" content="vscode">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210823210956.png">

<link rel="canonical" href="http://example.com/2021/08/25/windows%E4%B8%8A%E4%BD%BF%E7%94%A8VSCode%20CMake%E6%9E%84%E5%BB%BAC%20C++%20IDE/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>windows上使用VSCode CMake构建C C++ IDE | 学无止境</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">学无止境</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">Do not bb, show me the example</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://example.com/2021/08/25/windows%E4%B8%8A%E4%BD%BF%E7%94%A8VSCode%20CMake%E6%9E%84%E5%BB%BAC%20C++%20IDE/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="xudonglei">
      <meta itemprop="description" content="搬砖 嵌入式">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="学无止境">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          windows上使用VSCode CMake构建C C++ IDE
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-08-25 09:12:41" itemprop="dateCreated datePublished" datetime="2021-08-25T09:12:41+08:00">2021-08-25</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E5%B7%A5%E5%85%B7/" itemprop="url" rel="index"><span itemprop="name">工具</span></a>
                </span>
            </span>

          
            <span id="/2021/08/25/windows%E4%B8%8A%E4%BD%BF%E7%94%A8VSCode%20CMake%E6%9E%84%E5%BB%BAC%20C++%20IDE/" class="post-meta-item leancloud_visitors" data-flag-title="windows上使用VSCode CMake构建C C++ IDE" title="阅读次数">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span class="leancloud-visitors-count"></span>
            </span>
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="fa fa-comment-o"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2021/08/25/windows%E4%B8%8A%E4%BD%BF%E7%94%A8VSCode%20CMake%E6%9E%84%E5%BB%BAC%20C++%20IDE/#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/2021/08/25/windows%E4%B8%8A%E4%BD%BF%E7%94%A8VSCode%20CMake%E6%9E%84%E5%BB%BAC%20C++%20IDE/" itemprop="commentCount"></span>
    </a>
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h2 id="一、准备需要的软件"><a href="#一、准备需要的软件" class="headerlink" title="一、准备需要的软件"></a>一、准备需要的软件</h2><h3 id="1-1-cmake"><a href="#1-1-cmake" class="headerlink" title="1.1 cmake"></a>1.1 cmake</h3><p><a target="_blank" rel="noopener" href="https://cmake.org/download/">https://cmake.org/download/</a></p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210823210956.png" style="zoom:67%;">

<h3 id="1-2-ninja"><a href="#1-2-ninja" class="headerlink" title="1.2 ninja"></a>1.2 ninja</h3><p><a target="_blank" rel="noopener" href="https://github.com/ninja-build/ninja/releases/tag/v1.10.2">https://github.com/ninja-build/ninja/releases/tag/v1.10.2</a></p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210823211526.png" style="zoom:50%;">

<p>​    Ninja 是Google的一名程序员推出的注重速度的构建工具，一般在Unix/Linux上的程序通过make/makefile来构建编译，而Ninja通过将编译任务并行组织，提高了构建速度。可以通过cmake来生成ninja的配置，进而进行编译。</p>
<p><img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210823211635.png"></p>
<p>​      把它安装到cmake的安装路径：</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210823212036.png" style="zoom:50%;">

<h3 id="1-3-编译工具mingw"><a href="#1-3-编译工具mingw" class="headerlink" title="1.3 编译工具mingw"></a>1.3 编译工具mingw</h3><p>​    把下载下来的x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z文件解压之后会得到一个mingw64的文件夹，将其拷贝到你要安装的目录。解压完毕之后需要配置环境变量path下添加你的mingw64/bin，如：D:\Pro_Software\mingw64\bin。在cmd窗口使用 gcc -v去查看下。</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210823215506.png" style="zoom:50%;">

<p><strong>mingw-w64 版本选择方法</strong>   </p>
<p>​    32位系统选择i686, 64位系统选择x86_64   </p>
<p>​    线程模型：win32 : 没有C ++ 11多线程特性, posix : 支持C ++ 11多线程特性   </p>
<p>​    异常处理模型:32位系统推荐dwarf，64位系统推荐seh   </p>
<p>​    因为测试环境为64位系统，所以推荐配置为x86_64-posix-seh</p>
<h3 id="1-4-vscode插件安装"><a href="#1-4-vscode插件安装" class="headerlink" title="1.4 vscode插件安装"></a>1.4 vscode插件安装</h3><p>​    我安装了下面这些插件：</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/20210823221753.png" style="zoom:50%;">

<h2 id="2-实例演示"><a href="#2-实例演示" class="headerlink" title="2.实例演示"></a>2.实例演示</h2><h3 id="2-1-只有main-c文件的工程"><a href="#2-1-只有main-c文件的工程" class="headerlink" title="2.1 只有main.c文件的工程"></a>2.1 只有main.c文件的工程</h3><p>​    我们很多时候，只是为了在vscode上写一小段C代码来验证功能，这个时候其实根本不需要用makefile或者cmake来构建工程，下面就简单演示一下。</p>
<p>​    (1)main.c文件写好之后保存文件，然后点击菜单栏的运行，再点击启动调试</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824094955.png" style="zoom:50%;">

<p>​    (2)编译环境选择“GDB/LLDB”，Windows那个是给MSVC编译器用的，MingGW需要使用GDB。</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824095404.png" style="zoom:70%;">

<p>​    (3)配置选择gcc.exe(如果是C++就选择g++编译器!)</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824095527.png" style="zoom:67%;">

<p>​    (4)如果是第一次，这个动作会产生以下几个效果:自动创建并打开launch.json文件，自动打开调试控制台。同时，代码会被自动编译，并自动以调试模式执行一遍生成的程序。如果代码没什么问题，且未设置任何断点或等待外部输入的代码，这个黄框一般只会闪现一下，程序一结束就会回归正常。</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824100655.png" style="zoom:50%;">

<p>​    <strong>这一串动作的主要目的是让VS Code自动创建好tasks.json和launch.json文件</strong>，只要这两个文件内容正确，以后的调试工作就可以直接进行而无需再额外配置。</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824101047.png" style="zoom:59%;">

<p>​    (5)具体看一下launch.json和tasks.json文件</p>
<p><img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20210824102813.png"></p>
<p>​    “name”: “gcc.exe - 生成和调试活动文件”,      // 该调试任务的名字，启动调试时会在待选列表中显示。</p>
<p>​    “stopAtEntry”: false,  // 这一项控制是否在入口处暂停，默认false不暂停，改为true暂停。</p>
<p>​    “externalConsole”: false,  // 这一项控制是否启动外部控制台（单独的黑框）运行程序，默认false表示在集成终端中运行。</p>
<p>​    “preLaunchTask”: “C/C++: gcc.exe 生成活动文件”   <strong>// 调试前的预执行任务，这里的值是tasks.json文件中对应的编译任务，也就是调试前需要先编译</strong>。</p>
<p><img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20210824103927.png"></p>
<p>​    (6)tasks.json和launch.json文件创建好后，在这个打开的文件夹下所有“单文件的代码”就都可以直接顺利的调试了。</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824104500.png" style="zoom:50%;">

<h3 id="2-2-cmake管理复杂的项目"><a href="#2-2-cmake管理复杂的项目" class="headerlink" title="2.2 cmake管理复杂的项目"></a>2.2 cmake管理复杂的项目</h3><p>​    项目工程长下面这个样子：</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824192713.png" style="zoom:65%;">

<p>​    (1)按ctrl+shift+p：</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824193001.png" style="zoom:70%;">

<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/2微信截图_20210824193104.png" style="zoom:67%;">

<p>​    选择上面这个编译器，用它来构建环境。</p>
<p>​    注意在CMakeLists.txt文件的第13行，这个在windows上叫libm.a，在ubuntu上交libm.so。可以在你MinGW安装目录的lib目录下找到这个libm.a文件，这是一个数学库。</p>
<p>​    (2)然后配置项目：</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824200537.png" style="zoom:67%;">

<p>​    (3)生成可执行文件</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824200746.png" style="zoom:60%;">

<p>​    到这里可执行文件就生成了，后面就可以运行那个可执行文件了。</p>
<p>​    (4)用gdb调试程序</p>
<p>​    Cmakelists.txt中需要添加：set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -g)是必须的，否则无法正常调试。</p>
<p>​    选择“运行”-&gt;”添加配置”，<strong>后面记得选择“默认配置”，这样就只生成一个launch.json文件，否则还会生成tasks.json，因为我们这里用cmake已经编译出了可执行程序，所以不需要tasks.json文件。</strong></p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824201916.png" style="zoom:67%;">

<p>​    将生成的默认launch.json文件修改成如下所示：</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824202516.png" style="zoom:67%;">

<p>​    这样就可以用gdb调试了：</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210824202759.png" style="zoom:67%;">
    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/vscode/" rel="tag"># vscode</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2021/08/12/stm32%20usb%20cdc%E6%97%A0%E6%B3%95%E5%8F%91%E9%80%8164%E6%95%B4%E6%95%B0%E5%80%8D%E6%95%B0%E6%8D%AE/" rel="prev" title="stm32 usb cdc无法发送64整数倍数据">
      <i class="fa fa-chevron-left"></i> stm32 usb cdc无法发送64整数倍数据
    </a></div>
      <div class="post-nav-item">
    <a href="/2021/09/02/linux%E5%86%85%E6%A0%B8%E4%B8%AD%E7%9A%84kfifo/" rel="next" title="linux内核中的kfifo">
      linux内核中的kfifo <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%B8%80%E3%80%81%E5%87%86%E5%A4%87%E9%9C%80%E8%A6%81%E7%9A%84%E8%BD%AF%E4%BB%B6"><span class="nav-number">1.</span> <span class="nav-text">一、准备需要的软件</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-1-cmake"><span class="nav-number">1.1.</span> <span class="nav-text">1.1 cmake</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-2-ninja"><span class="nav-number">1.2.</span> <span class="nav-text">1.2 ninja</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-3-%E7%BC%96%E8%AF%91%E5%B7%A5%E5%85%B7mingw"><span class="nav-number">1.3.</span> <span class="nav-text">1.3 编译工具mingw</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-4-vscode%E6%8F%92%E4%BB%B6%E5%AE%89%E8%A3%85"><span class="nav-number">1.4.</span> <span class="nav-text">1.4 vscode插件安装</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E5%AE%9E%E4%BE%8B%E6%BC%94%E7%A4%BA"><span class="nav-number">2.</span> <span class="nav-text">2.实例演示</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-%E5%8F%AA%E6%9C%89main-c%E6%96%87%E4%BB%B6%E7%9A%84%E5%B7%A5%E7%A8%8B"><span class="nav-number">2.1.</span> <span class="nav-text">2.1 只有main.c文件的工程</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-cmake%E7%AE%A1%E7%90%86%E5%A4%8D%E6%9D%82%E7%9A%84%E9%A1%B9%E7%9B%AE"><span class="nav-number">2.2.</span> <span class="nav-text">2.2 cmake管理复杂的项目</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">xudonglei</p>
  <div class="site-description" itemprop="description">搬砖 嵌入式</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">283</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">19</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">67</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2024</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">xudonglei</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://muse.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Muse</a> 强力驱动
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>




  




  
<script src="/js/local-search.js"></script>













  

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail', 'link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : false,
      notify     : false,
      appId      : 'BT0Qw9HcTpPv1a6cT1iDBXKz-gzGzoHsz',
      appKey     : 'LMCMh8v02JTMFAwKNRcgoizI',
      placeholder: "Just go go",
      avatar     : 'mm',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : true,
      lang       : 'zh-CN' || 'zh-cn',
      path       : location.pathname,
      recordIP   : false,
      serverURLs : ''
    });
  }, window.Valine);
});
</script>

</body>
</html>
